package cn.yj.syslog.aspect.error;

import cn.yj.syslog.service.ISysLogService;
import org.springframework.aop.support.StaticMethodMatcherPointcutAdvisor;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Method;

/**
 * @author 永健
 * @since 2021-04-15 14:29
 */
@Component
public class ExceptionHandlerMatcherPointcutAdvisor extends StaticMethodMatcherPointcutAdvisor {

    public ExceptionHandlerMatcherPointcutAdvisor() {
        super.setAdvice(new ExceptionHandlerMethodInterceptor());
    }

    /**
     * && method.getAnnotation(OperateLog.class) != null
     * @param method
     * @param aClass
     * @return
     */
    @Override
    public boolean matches(Method method, Class<?> aClass) {
        return (method.getAnnotation(ExceptionHandler.class) != null);
    }
}
